﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MyLibary.DAL;

namespace MyLibary.BIZ
{
    public class BIZ_HoaDonNhap
    {
        public string MaHDNhap { get; set; }
        public DateTime NgayNhap { get; set; }
        public decimal TongTien { get; set; }
        #region Contructor
        public BIZ_HoaDonNhap() { }
        public BIZ_HoaDonNhap(string MaHDNhap, DateTime NgayNhap,decimal TongTien)
        {
            this.MaHDNhap = MaHDNhap;
            this.NgayNhap = NgayNhap;
            this.TongTien = TongTien;
        }
        #endregion
        #region Metholds

        public static List<BIZ_HoaDonNhap> getAll()
        {
            return DAL_HoaDonNhap.getAll();
        }
        public static BIZ_HoaDonNhap getByID(string MaHDNhap)
        {
            return DAL_HoaDonNhap.GetByID(MaHDNhap);
        }
        public bool IsExists()
        {
            return DAL_HoaDonNhap.GetByID(this.MaHDNhap) != null;
        }
        public bool Add()
        {
            return DAL_HoaDonNhap.Insert(this);
        }
        public bool Update()
        {
            return DAL_HoaDonNhap.Update(this);
        }
        public bool Delete()
        {
            return DAL_HoaDonNhap.Delete(this);
        }
        #endregion
    }
    class IEQualityCompareHoaDonNhap : IEqualityComparer<BIZ_HoaDonNhap>
    {
        #region IEQualityCompareHoaDonNhap
        public bool Equals(BIZ_HoaDonNhap x, BIZ_HoaDonNhap y) { return x.MaHDNhap == y.MaHDNhap; }
        public int GetHashCode(BIZ_HoaDonNhap Object) { return Object.GetHashCode(); }
        #endregion
    }
}
